package com.action.book;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.controller.Action;
import com.dao.BookDao;

public class BookDeleteProAction implements Action{
	@Override
	public String execute(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		request.setCharacterEncoding("euc-kr");
		HttpSession session = request.getSession();
		String mem_id = (String)session.getAttribute("mem_id");
		if(!mem_id.equals("admin")){
			return "/view/member/loginForm.jsp";
		}
		
		int book_num = Integer.parseInt(request.getParameter("book_num"));
		
		BookDao dao = BookDao.getinstance();
		dao.deleteBook(book_num);
		
		return "/view/book/bookDeletePro.jsp";
	}
}
